package object;

public class IntegerDemo {
    public static void main(String[] args) {
        String s1="21";
        int age=Integer.parseInt(s1);
        System.out.println(age);
        String s2="1233.45";
        double price=Double.parseDouble(s2);
        System.out.println(price);


        int max=Integer.MAX_VALUE;
        int min=Integer.MIN_VALUE;
        System.out.println(max+","+min);

        long max1=Long.MAX_VALUE;
        long min1=Long.MIN_VALUE;
        System.out.println(max1+","+min1);


        Integer i1=new Integer(100);
        Integer i2=new Integer(100);
        System.out.println(i1==i2);
        System.out.println(i1.equals(i2));
        //valueOf()方法会复用1个字节(-128到127)范围内的数据，建议使用valueOf()
        Integer i3=Integer.valueOf(128);
        Integer i4=Integer.valueOf(128);
        System.out.println(i3==i4);
        System.out.println(i3.equals(i4));

        //将包装类转换为基本类型
        int i=i4.intValue();
        System.out.println(i);


        Double d1=Double.valueOf(5.0);
        Double d2=Double.valueOf(5.0);
        System.out.println(d1==d2);
        System.out.println(d1.equals(d2));
        double d=d1.doubleValue();
        System.out.println(d);

    }
}
